<?php

/**
 * FootballFactory, Copyright Robin Loop & Pascal Wirz, 2014
 * ---
 * [Beschreibung der Datei]
 *
 * @author Robin
 */

require_once($_SERVER['DOCUMENT_ROOT']."/ff_config.php");

include "../ff_includes/class_database.php";
include "../ff_includes/class_game.php";
include "../ff_includes/class_gamevenue.php";

function printNextGame($team_id, $title) {
    $game = Game::getNextGameByTeam($team_id);
    if (is_null($game)) {
        echo '<div class="nextgame">
        <h3>'.$title.'</h3>
        <p>Kein Spiel gefunden</p>
     </div>';
        
        return;
    }
    
    $venue = Gamevenue::getGamevenueById($game->getVenue());
    $wtage = array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag");
    
    echo '<div class="nextgame">
        <h3>'.$title.'</h3>
        <img src="'.PATH_NEXTGAME_IMG.$game->getImagelink().'" />
        <p>'.$game->getHometeam()." - ".$game->getAwayteam().'<br/>
            <a href="'.$venue->getMaplink().'" target="_blank">
                '.$venue->getName().", ".$venue->getCity().'<br/>
            </a>
            '.$wtage[date("w", strtotime($game->getDate()))].', '.date('d.m.Y - H:i', strtotime($game->getDate())).' Uhr'
        .'</p>
     </div>';
}

?>

